/**
 * 计划相关接口
 */
import httpService from '@/api/httpService';
import { base } from '@/config/api-url-config';

// 获取计划列表
const GET_PLAN_LIST = function(body) {
  return new Promise((resolve) => {
    httpService
      .accessAPI({
        apiObj: { url: `${base}/selectList`, method: 'GET' },
        body
      })
      .then(res => {
        // 对请求接口改数据，进行公共验证或处理
        resolve(res);
      });
  });
};
// 新增计划
const ADD_KEEP_PLAN = function(body) {
  return new Promise((resolve) => {
    httpService
      .accessAPI({
        apiObj: { url: `${base}/insertKeepPlan`, method: 'GET' },
        body
      })
      .then(res => {
        // 对请求接口改数据，进行公共验证或处理
        resolve(res);
      });
  });
};
// 删除计划
const DELETE_KEEP_PLAN = function(body) {
  return new Promise((resolve) => {
    httpService
      .accessAPI({
        apiObj: { url: `${base}/deleteKeepPlan`, method: 'GET' },
        body
      })
      .then(res => {
        // 对请求接口改数据，进行公共验证或处理
        resolve(res);
      });
  });
};
// 编辑计划
const EDIT_KEEP_PLAN = function(body) {
  return new Promise((resolve) => {
    httpService
      .accessAPI({
        apiObj: { url: `${base}/updateKeepPlan`, method: 'GET' },
        body
      })
      .then(res => {
        // 对请求接口改数据，进行公共验证或处理
        resolve(res);
      });
  });
};
export {
  GET_PLAN_LIST,
  ADD_KEEP_PLAN,
  DELETE_KEEP_PLAN,
  EDIT_KEEP_PLAN
};
